﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using tactics.Interfaces;
using tactics.GUI;

namespace tactics.Commands
{
    public class KillUnitCommand : BaseCommand
    {
        Unit unit;
        Player player;

        public KillUnitCommand(Unit unitIn)
        {
            unit = unitIn;
            foreach(Player p in TacticsEngine.Instance.Game.Players)
            {
                foreach(Unit u in p.Units)
                {
                    if (u == unit)
                    {
                        player = p;
                    }
                }
            }
        }

        public override void Execute()
        {
            player.Units.Remove(unit);
           
            TacticsEngine.Instance.Game.MiniDisplayManager.Update(TacticsEngine.Instance.Game.Players);
            Finished = true;
        }
    }
}
